package luogu;

import java.util.Scanner;

public class Main8 {
    public static void main(String[] args) {
                Scanner scanner = new Scanner(System.in);
                int n = scanner.nextInt();

                int[] sequence = new int[1000]; // 假设序列长度不超过1000
                int index = 0;

                // 正向计算序列
                while (n != 1) {
                    sequence[index++] = n;
                    if (n % 2 == 1) {
                        n = n * 3 + 1;
                    } else {
                        n = n / 2;
                    }
                }
                sequence[index++] = 1; // 最后加上1

                // 倒序输出
                for (int i = index - 1; i >= 0; i--) {
                    if (i != index - 1) {
                        System.out.print(" ");
                    }
                    System.out.print(sequence[i]);
                }
            }
        }
